﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true"
    CodeFile="CartDetails.aspx.cs" Inherits="CartDetails" %>

<asp:Content ID="cntMain" ContentPlaceHolderID="cphZone1" runat="Server">
    <asp:ValidationSummary runat="server" id="vsumCartDetails" HeaderText="&lt;b&gt;&amp;nbsp;There were some problems with your entries:&lt;/b&gt;" />
    <asp:Panel runat="server" ID="pnlCartDetails" DefaultButton="btnUpdateCart">
    <p class="sectionTitle">Shopping Cart</p>
    <asp:GridView ID="gvShoppingCart" runat="server" AutoGenerateColumns="False" 
        ShowFooter="true" onrowdeleting="gvShoppingCart_RowDeleting" 
        onrowdatabound="gvShoppingCart_RowDataBound" SkinID="Cart" Width="100%">
        <EmptyDataTemplate>
            There are no products in the shopping cart.
        </EmptyDataTemplate>
        <Columns>
            <asp:TemplateField HeaderText="Delete">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                    <asp:LinkButton runat="server" ID="lnkbtnRemove" Text="Remove" CommandName="Delete"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Item Number">
                <HeaderStyle HorizontalAlign="Left" />
                <ItemStyle HorizontalAlign="Left" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblItemNumber" Text='<%# Eval("ItemNumber") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Title">
                <HeaderStyle HorizontalAlign="Left" />
                <ItemStyle HorizontalAlign="Left" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblProductTitle" Text='<%# Eval("ProductTitle") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Each">
                <HeaderStyle HorizontalAlign="Left" />
                <ItemStyle HorizontalAlign="Left" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Eval("UnitPrice", "{0:c}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Qty.">
                <HeaderStyle HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                    <asp:TextBox runat="server" ID="txtQuantity" Text='<%# Eval("Quantity") %>' Width="36px" MaxLength="2"></asp:TextBox>&nbsp;<asp:RegularExpressionValidator runat="server" ID="revQuantity" Display="Dynamic" ErrorMessage="Invalid quantity." ToolTip="Invalid quantity." ValidationExpression="^([1-9]|[1-9]\d|100)$" ControlToValidate="txtQuantity">&nbsp;</asp:RegularExpressionValidator>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Total">
                <HeaderStyle HorizontalAlign="Right" />
                <ItemStyle HorizontalAlign="Right" />
                <FooterStyle HorizontalAlign="Right" />
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblTotal" Text='<%# Eval("Total", "{0:c}") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label runat="server" ID="lblGrandTotal" Font-Bold="true"></asp:Label>
                </FooterTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    <asp:Button runat="server" ID="btnUpdateCart" Text="Update Cart" OnClick="btnUpdateCart_Click" />&nbsp;<asp:Button
        runat="server" ID="btnCheckout" Text="Checkout" OnClick="btnCheckout_Click" />
    </asp:Panel>
</asp:Content>
